package com.hydong.novatest.fragment

import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import com.hydong.novatest.R
import com.hydong.novatest.activity.AboutActivity
import com.hydong.novatest.base.BaseFragment
import com.qmuiteam.qmui.util.QMUIDisplayHelper
import com.qmuiteam.qmui.widget.QMUITopBarLayout
import com.qmuiteam.qmui.widget.grouplist.QMUIGroupListView

class MineFragment : BaseFragment() {

    override fun onCreateView(): View {
        val view = LayoutInflater.from(activity).inflate(R.layout.fragment_mine, null)
        initView(view)
        return view
    }

    private fun initView(view: View) {
        var topbar = view.findViewById<QMUITopBarLayout>(R.id.topbar)
        topbar.setTitle("Mine")

        topbar.addRightImageButton(R.mipmap.icon_topbar_about, R.id.topbar_right_about_button).setOnClickListener {
            startActivity(Intent(activity, AboutActivity::class.java))
        }


        var briefList = view.findViewById<QMUIGroupListView>(R.id.brief_list)

        QMUIGroupListView.newSection(activity)
            .addItemView(briefList.createItemView("我的作品")) {
            }
            .addItemView(briefList.createItemView("我的私信")) {
            }
            .addItemView(briefList.createItemView("我的订单")) {
            }
            .setMiddleSeparatorInset(QMUIDisplayHelper.dp2px(getContext(), 16), 0)
            .addTo(briefList)

        QMUIGroupListView.newSection(activity)
            .addItemView(briefList.createItemView("软件版本")) {
            }
            .addItemView(briefList.createItemView("设置")) {
            }
            .setMiddleSeparatorInset(QMUIDisplayHelper.dp2px(getContext(), 16), 0)
            .addTo(briefList)
    }

}